const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
// const CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
  entry: {
     app: './src/index.js',
   },
   devtool: 'inline-source-map',
   devServer: {
     contentBase: './dist'
   },
   plugins: [
  	 // new CleanWebpackPlugin(),
       new VueLoaderPlugin(),
     new HtmlWebpackPlugin({
       title: 'vue项目'
     })
   ],
   output: {
     filename: 'bundle.js',
     path: path.resolve(__dirname, 'dist')
   },
   module: {
    rules: [
      { test: /\.css$/, use: ["style-loader", "css-loader"] },
      {
        test: /\.(jpg|png|gif|bmp|jpeg)$/,
        use: "url-loader?limit=987654"
      },
      {
        test: /\.(ttf|eot|svg|woff|woff2)$/,
        use: "url-loader"
      },
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: "babel-loader"
        }
      },
      {
        test: /\.(woff|woff2|eot|ttf|otf)$/,
        use: "url-loader"
      },
        {
            test: /\.vue$/,
            use:"vue-loader"
        }
    ]
  }
};

